home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2046 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.6 KB

  1. Path: ns.cs.hku.hk!sdlee
  2. From: sdlee@cs.hku.hk (Lee Sau Dan ~{@nJX6X~})
  3. Newsgroups: hku.open-forum,hku.cc.forum,hk.comp.pc,comp.lang.c++,comp.lang.pascal.misc
  4. Subject: Re: Is Pascal worth to learn? Can it help me to get a job?
  5. Date: 15 Jan 1996 08:13:38 GMT
  6. Organization: Computer Science Dept, University of Hong Kong
  7. Message-ID: <SDLEE.96Jan15161338@champion.cs.hku.hk>
  8. References: <30f2adf8.7810115@news.hku.hk> <DL2tFM.7DJ@hkuxb.hku.hk>
  9.     <4dcrl0$7mo_001@news.hku.hk>
  10. NNTP-Posting-Host: champion.cs.hku.hk
  11. In-reply-to: kong@hkusua.hku.hk's message of Mon, 15 Jan 1996 06:19:12 GMT
  12.  
  13. In article <4dcrl0$7mo_001@news.hku.hk> kong@hkusua.hku.hk (someone) writes:
  14.  
  15.     >>    I can't agree with this. There are things that you simply
  16.     >> can't do in Pascal.
  17.  
  18. Yes, but for a beginner, these limitations are not significant.
  19.  
  20.  
  21.     >>    For example, in C I can swap two integers a and b without
  22.     >> using a temporary variable in three statements: a ^= b; b ^= a;
  23.     >> a^= b , I can also use bit-vectors.
  24.  
  25. This method of swapping is not as easy to understand as the method of
  26. using a temp. variable.  Moreover, bit-vectors are for memory
  27. optimization (and, to a certain extent speed optimization).  They are
  28. difficult to debug and maintain and do not generalize to other
  29. problems.  (E.g. when you swap to strings, you cannot use your proposed
  30. method.)  This is not a good programming practice.
  31.  
  32. So, to a beginner, these limitations are advantageous.  They train
  33. a programmer to write more structurally and maintainably.
  34.  
  35.  
  36.     >>    I can have generic pointers that may point to everything or
  37.     >> nothing.
  38.  
  39. Well... when you use such pointers, bear in mind the potential problems
  40. and bugs that may result.  Such pointers bypasses the strong type-checking
  41. mechanism of the language.  Think twice and before using such pointers.
  42. They are often better ways to do the same thing.
  43.  
  44.  
  45.     >> I can have arrays with no compile-time defined sizes.
  46.  
  47. Beware of out-of-bound array references, then!  BTW, does C support
  48. multi-dimensional arrays cleanly so that they can be passed into
  49. procedures?
  50.  
  51.  
  52.     >> AFAIK there are no way of doing such things in Pascal. At least
  53.     >> not in standard Pascal. There are also many fallbacks in Pascal
  54.     >> that are inconvenient for programmers,
  55.  
  56. Well... They are not always inconvenient for programers.  Very often,
  57. they help to prevent bugs early.  
  58.  
  59.  
  60.     >> e.g. no break within loops.  That's why there are things like
  61.     >> Modula-2.
  62.  
  63. Some people do not consider 'breaking' in loops a good style of writing
  64. structured programs.  In fact, if you HAVE TO do so, you can do that
  65. with GOTO in pascal.  However, as GOTO is discouraged in structured
  66. programming, breaks are also not encouraged.
  67.  
  68.  
  69.     >>    For the original poster, so far I have only seen one
  70.     >> employer in Hong Kong that specifically requires Pascal. It's
  71.     >> one of those news agencies. And believe it or not, they use
  72.     >> VAX!!
  73.  
  74. There are even more jobs for dBase, Clipper, FoxPro programmers.
  75. So, you should persuade all people to learn them, rather than Pascal
  76. or C.
  77.  
  78. Anyway, learning a computer language is just a means of learning
  79. programming.  Once you have the skills, you can easily pick up any
  80. other languages.  Most of the time, you just learn a new syntax
  81. (e.g. when you learn C after knowing Pascal).  Sometimes you need to
  82. learn another paradigm (e.g. OOP in C++).  However, the algorithms and
  83. skills that you know can still apply.  Learning a new computer
  84. language is not as difficult as learning a new human language.
  85.  
  86.  
  87. --
  88. Lee Sau Dan
  89.  
  90. -------------------------------------------------------------------------------
  91. URL: http://www.cs.hku.hk/~sdlee
  92. e-mail: sdlee@cs.hku.hk
  93.